package com.elinkway.infinitemovies.adapter;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.elinkway.infinitemovies.ui.fragment.CopyrightFragment;
import com.elinkway.infinitemovies.ui.fragment.UserFeedBackFragment;

/**
 * Created by zhaopeipei on 2016/6/13.
 */
public class FeedBackFragmentPagerAdapter  extends FragmentStatePagerAdapter {

    private final String[] TITLES = { "用户反馈", "版权举报"};

    public FeedBackFragmentPagerAdapter(FragmentManager fm, Context context) {
        super(fm);
        // TODO Auto-generated constructor stub
    }

    @Override
    public Fragment getItem(int position) {
        // TODO Auto-generated method stub
        if (TITLES[position].equalsIgnoreCase("用户反馈")) {
            Fragment fragment = null;
            fragment = new UserFeedBackFragment();
            return fragment;
        } else if (TITLES[position].equalsIgnoreCase("版权举报")) {
            Fragment fragment = null;
            fragment = new CopyrightFragment();
            return fragment;
        }else {
            return null;
        }
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return TITLES.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return TITLES[position];
    }

}
